using UnityEngine;
using System.Collections;

public class Skill : MonoBehaviour {
	public AttackDecision atkDecision;
	public string[] SkillAnimation;
	public enum SkillType{projectile, area,melee};
	public enum DamageType{normal, buff, debuff};
	
	public int minAttackPower = 5;
	public int maxAttackPower = 10;
	public float castingDuration = 0;
	public float costMana = 0;
	public float decisiveMoment = 0.1f;
	public float hitDuration = 0.15f;
	public float coolDownDuration = 0.1f;
	public Vector3 knockVelocity = new Vector3(0,0,0);
	
	
	public SkillType skillType = Skill.SkillType.melee;
	public DamageType damageType = Skill.DamageType.normal;
	
	public string[] parameterNames = {"Effect Duration","Projectile Speed","Radius"};
	public float[] parameterValues = {0,0,0};
	
	public float skillTimer;
	
	public GUITexture SkillUI;
			
	
	// Use this for initialization
	void Awake () {
		
	}
	
	// Update is called once per frame
	void Update () {
		
	}
	
	public float getAnimationTime() {
		return decisiveMoment + hitDuration + coolDownDuration;
	}
	
	public string GetRandomAnimation()
	{
		int size = SkillAnimation.Length;
		
		return this.SkillAnimation[Random.Range(0,size-1)];
	}
	
	public void apply(Defender def)
	{
		//print("Apply Skill to " + def.gameObject.name);
		if (skillType == SkillType.melee) {
		}
		
		if (damageType == DamageType.normal) {
			skillTimer = Time.deltaTime;
			def.takeDamage((int)(minAttackPower * skillTimer / hitDuration));
			//print((int)(minAttackPower * skillTimer / hitDuration));
			print(skillTimer);
		}
		
	}
	
}
